<template>
    <p style="color: red;">温馨提示：换绑手机号需未注册畅玩</p>
    <a-form
      :model="formState"
      name="basic"
      :label-col="{ span: 9 }"
      :wrapper-col="{ span: 6 }"
      autocomplete="off"
      @finish="onFinish"
      @finishFailed="onFinishFailed"
    >
      <a-form-item
        label="订单账号"
        name="username"
        :rules="[{ required: true, message: 'Please input your username!' }]"
      >
        <a-input v-model:value="formState.username" />
      </a-form-item>
      <a-form-item :wrapper-col="{ offset: 9, span: 6 }">
        <a-button type="primary" html-type="submit">提交</a-button>
      </a-form-item>
    </a-form>
  </template>
<script setup>
import { reactive } from 'vue';
import request from './utils';
import {message} from 'ant-design-vue'
  const formState = reactive({
    username: '',
    password: ''
  });
  const onFinish = values => {
    console.log('Success:', values);
    const {username} = values
    request({
      url: "/app/getPhone",
      params:{username}
    }).then((res) => {
      if(res.status == 'success'){
        message.success(res.msg)
        request({
          method:"post",
          url: "/app/logout",
          data: {accout:username}
        })
      }
    })
    /* request({
        method:"post",
        url: "/app/logout",
        data: {accout:username}
     }) */
  };
  const onFinishFailed = errorInfo => {
    console.log('Failed:', errorInfo);
  };
  </script>